package com.briercliffe.settlers.core.domain;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.apache.commons.collections.iterators.LoopingIterator;

import com.briercliffe.settlers.core.events.game.GameDetails;

/**
 * User: briercliffe
 * Date: 10/9/13
 */
public class Game
{
    // ==================================================
    // class static data
    // ==================================================

    // ==================================================
    // class static methods
    // ==================================================
    public static Game fromGameDetails(final GameDetails iGameDetails)
    {
        Game game = new Game();

        return game;
    }

    // ==================================================
    // instance data
    // ==================================================
    private UUID mUUID;
    private Board mBoard;
    private List<User> mUsers;
    private User mCurrentUser;
    private Date mStartDate;

    private LoopingIterator mUserIterator;
    private Dice mDice;

    // ==================================================
    // factories
    // ==================================================

    // ==================================================
    // constructors
    // ==================================================

    public Game() {
        mDice = new Dice();
        mUserIterator = new LoopingIterator(mUsers);
        mCurrentUser = (User) mUserIterator.next();
    }
    // ==================================================
    // public methods
    // ==================================================

    public GameDetails toGameDetails() {
        GameDetails gameDetails = new GameDetails();

        return gameDetails;
    }

    public User nextUser() {
        mCurrentUser = (User) mUserIterator.next();
        return mCurrentUser;
    }
    // ==================================================
    // non public methods
    // ==================================================

    // ==================================================
    // getters / setters
    // ==================================================
    public UUID getUUID()
    {
        return mUUID;
    }

    public void setUUID(final UUID iUUID)
    {
        mUUID = iUUID;
    }

    public Board getBoard()
    {
        return mBoard;
    }

    public void setBoard(final Board iBoard)
    {
        mBoard = iBoard;
    }

    public List<User> getUsers()
    {
        return mUsers;
    }

    public void setUsers(final List<User> iUsers)
    {
        mUsers = iUsers;
    }

    public User getCurrentUser()
    {
        return mCurrentUser;
    }

    public void setCurrentUser(final User iCurrentUser)
    {
        mCurrentUser = iCurrentUser;
    }

    public Date getStartDate()
    {
        return mStartDate;
    }

    public void setStartDate(final Date iStartDate)
    {
        mStartDate = iStartDate;
    }

    public Dice getDice()
    {
        return mDice;
    }

    public void setDice(final Dice iDice)
    {
        mDice = iDice;
    }
}
